<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\Route;

//绑定子域名

Route::domain('api', function(){
    
    //各种类别都搞定了
    Route::rule(':version/:controller$', 'api/:version.:controller/index');
    Route::rule(':version/:controller/:function', 'api/:version.:controller/:function');//很多自己定义的不符合风格的，不过get没法子一律被当做read
    

    //    //广告
    Route::rule(':version/ad/pid/:pid', 'api/:version.ad/pid','GET',['pid'=>'\w+']);
    Route::rule(':version/ad/:id', 'api/:version.ad/read','GET',['id'=>'\w+']);
    Route::rule(':version/ad', 'api/:version.ad/index');

    Route::rule('/', 'api/index/index');

//    Route::resource(':version/:controller','api/:version.:controller');//resetful
    

    
});

//    Route::rule(':version/:controller$', 'api/:version.:controller/index');
//    Route::rule(':version/:controller/:id', 'api/:version.:controller/read',['method' => 'get'], ['id' => '\d+']);
//     Route::rule(':version/:controller/:function$', 'api/:version.:controller/:function$',['method' => 'get,post,delete']);

return [
    
    '__rest__'=>[
    
    
    ],
    '__domain__'=>[
        'admin'      => 'admin',
        'seller'      => 'seller',
    ],


];

